/* File Info 
 * Author:      cknight 
 * CreateTime:  2021/1/20 下午1:18:52 
 * LastEditor:  cknight 
 * ModifyTime:  2021/1/22 上午10:01:43 
 * Description: 初始化wechaty
 */
const { Wechaty } = require('wechaty');
// 引入PuppetPadlocal
// const { PuppetPadlocal } = require("wechaty-puppet-padlocal");
// 引入配置文件
// const config = require('./config/index.js');s
// ipad协议
const bot = new Wechaty({
    // puppet: new PuppetPadlocal({ token: config.TOKEN, }),
    puppet: 'wechaty-puppet-wechat',
    name: 'cknight-robot',
});
// 只有放在此处才能正常导出，未知原因、可能与版本有关
module.exports = bot;
// 监听事件触发回调
bot.on('scan', require('./listeners/on-scan.js'))
    .on('login', require("./listeners/on-login.js"))
    .on('message', require('./listeners/on-message.js'))
    .on('friendship', require('./listeners/on-friendship.js'))
    .on('room-join', require('./listeners/on-room-join.js'))
    .on('room-leave', require('./listeners/on-room-leave.js'))
    .start()
    .then(() => {
        console.log('开始登陆微信');
    })
    .catch(e => console.error(e));
// module.exports.bot = bot;